package data;

import java.io.Serializable;

public class Business implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public String name;
	public String address;
	public String category;
	public String city;
	public String subdivision;
	public int sizeLevel;
	public int activityLevel;
	public int checkins;
	public double lat;
	public double lon;
	
	
	public Business(String name, String address, String category, String city, String subdivision, int sizeLevel, int activityLevel, int checkins, double lat, double lon) {
		this.name = name;
		this.address = address;
		this.category = category;
		this.city = city;
		this.subdivision = subdivision;
		this.sizeLevel = sizeLevel;
		this.activityLevel = activityLevel;
		this.checkins = checkins;
		this.lat = lat;
		this.lon = lon;
		
		nameCleaner();
	}
	
	public void nameCleaner(){
		String newname = "";
		String [] pieces = this.name.split("'");
		for(int i=0;i<pieces.length;i++)
			newname += pieces[i]+"&amp;";
		
		this.name = newname.substring(0,newname.length()-"&amp;".length());
	}
	
	public int hashCode() {
		return (name+address).hashCode();
	}
	public boolean equals(Object o) {
		if(o instanceof Business) {
			Business b = (Business)o;
			return name.equals(b.name) && address.equals(b.address);
		}
		return false;
	}

}
